#!/bin/bash

# Get the number of processors, by default, 4
if [ "$#" -ge 1 ]; then
   np=$1
else
   np=4
fi

# set the environment
. ../0-tools/environment

#
ulimit -s unlimited

# Step 1: static of unrelaxed
rm -rf INCAR POSCAR
cp POSCAR.ini POSCAR
ln -s INCAR.static INCAR
mpirun -np ${np} ${VASP}
mv OUTCAR OUTCAR.01

# Step 2: relaxation
rm -rf INCAR
ln -s INCAR.relax INCAR
mpirun -np ${np} ${VASP}
mv OUTCAR OUTCAR.02

# Step 3: static of relaxed
rm -rf INCAR
ln -s INCAR.static INCAR
cp CONTCAR POSCAR
mpirun -np ${np} ${VASP}
mv OUTCAR OUTCAR.03
